<?php
header("Content-Type: text/plain;charset=utf-8");
header("Access-Control-Allow-Origin:*");
header("Access-Control-Methods:POST,GET");
session_start();
require_once('../../com/dao/userDao.php');

$account = $_POST['account'];
//echo "account=".$account;
$psw = $_POST['psw'];
//echo "psw=".$psw;

$userDao = new UserDao();
$query = $userDao->selectPsw($account);
$pswResult = mysqli_fetch_assoc($query);
$truePsw = $pswResult['user_psw'];

if($psw==$truePsw){
	$_SESSION['useraccount'] = $account;
	$result = array('key'=>'success');
}else{
    $result = array('key'=>'error');
}

echo json_encode($result,JSON_UNESCAPED_UNICODE);